/***************************************************************************
 创建者: 华磊
 开始时间: 2020.8.14
 copyright: (C) 深圳市华友高科有限公司
 修改说明: (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 example (1) hualei 2020.5.8 类的具体实现代码编写

 ***************************************************************************/
#include "vehicleitem.h"
#include <QGraphicsScene>
#include <math.h>

VehicleItem::VehicleItem(QObject *parent)
{
    position_x=0;
    position_y=0;
    position_a=0;
    setFlag(QGraphicsItem::ItemIsMovable);

    carPicture.load("/agvwork/AgvHmi/baseBag/hmiProject/resources/mapView/CAR_1.png");

}

int VehicleItem::setPosition(double x, double y, double a)
{
    position_x=x;
    position_y=y;
    position_a=a;
    setPos(position_x,position_y);
    setRotation(position_a);
    return 1;

}

QRectF VehicleItem::boundingRect() const
{
    return QRectF(0,0,carPicture.width(),carPicture.height());
}

void VehicleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{

     painter->drawPixmap(position_x,position_y,carPicture);
//     setPos(position_x,position_y);
//     setRotation(position_a);

}

void VehicleItem::timerEvent()
{

}
